package factory.simple;

import java.util.Objects;

public class CarFactory {
    public static Car getCar(String carName){
        if(Objects.equals(carName,"MoBai")){
            return new MoBai();
        }else if(Objects.equals(carName,"DaBen")){
            return new DaBen();
        }else if(Objects.equals(carName,"BaoMa")){
            return new BaoMa();
        }else{
            throw new RuntimeException("参数异常，请输出正确的carName");
        }
    }
}
